import Vue from 'vue'
import VueRouter from 'vue-router'
import index from "../layout/index.vue";
import home from "../views/Home.vue"
Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    name: 'index',
    component: index,
    children:[
      {
        path:"",
        component: home
      },
      {
        path:"singer",
        component: ()=> import('../views/singer')
      },
      {
        path:"songlist",
        component: ()=> import('../views/songList')
      },
      {
        path:"mine",
        component: ()=> import('../views/mine')
      },
      {
        path:"search",
        component: ()=> import('../views/search'),
        children:[
          {
            path:'',
            component:() => import('../views/searcjResult')
          }
        ]
      },
      {
        path: "listDetail",
        component: ()=> import('../views/listDetail')
      },
      {
        path: "singerSong",
        component: ()=> import('../views/singerSong')
      },
      {
        path: "many",
        component: ()=> import('../views/many')
      },
      {
        path: "collect",
        component: ()=> import('../views/collectList')
      }
    ]
  },
  {
    path: "/musicDetail",
    component: ()=> import('../views/musicDetail')
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  linkActiveClass:'active',
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
